import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:fluttermodule/page/Battery/BatteryLevelPage.dart';
import 'package:fluttermodule/page/OrderMeal/OrderMealIndexPage.dart';
import 'package:fluttermodule/page/OrderMeal/OrderMealRecordPage.dart';
import 'package:fluttermodule/page/University/CourseDetail/CourseDetailPage.dart';
import 'package:fluttermodule/page/University/UniversityIndexPage.dart';



import 'RouterConfig.dart';

class RouterHelper {
  static String routerParam = '';
  static setRouterParam(String param){
    routerParam = param;
  }

  //通过地址url获取对应的页面的Widget
  static Widget routerWidget(String routerUrl) {
    switch (routerUrl) {
      case'/':
      case '/university_index_page':
        return MaterialApp(
          title: "UniversityIndexPage",
          home: UniversityIndexPage(),
          theme: ThemeData(
            brightness: Brightness.light,
            primaryColor: Colors.blue,
          ),
          darkTheme: ThemeData(
            brightness: Brightness.dark,
          ),
        );
        break;
      case '/course_detail_page':
        return MaterialApp(
          title: "CourseDetailPage",
          home: CourseDetailPage(),
        );
        break;
      case OrderMeal.OrderMealIndexPage:
        return MaterialApp(
          title: "OrderMealIndexPage",
          home: OrderMealIndexPage(),
          routes: routerConfig,
        );
        break;
      case OrderMeal.OrderMealRecordPage:
        return MaterialApp(
          title: "OrderMealRecordPage",
          home: OrderMealRecordPage(),
        );
        break;
      case OrderMeal.BatteryLevel:
        return MaterialApp(
          title: "OrderMealRecordPage",
          home: BatteryLevel(),
        );
        break;
    }
  }
}
